<!DOCTYPE html>
<html>
<head>
    <title>订单奖励金配置表</title>
    <#include "/header.html">
</head>
<body>
<div id="app">
    <div v-show="showList">
        <el-table ref="tableData" :data="tableData" style="width:100%" border highlight-current-row class="tb-edit"
                  :default-sort="{prop: 'id', order: 'ascending'}" @selection-change="handleSelectionChange" @row-click="handleclick">
            <el-table-column prop="id" label="ID" sortable show-overflow-tooltip></el-table-column>
            <el-table-column prop="configType" label="类型" sortable show-overflow-tooltip></el-table-column>
            <el-table-column prop="dataValue" label="数值" sortable show-overflow-tooltip width="300"></el-table-column>
            <el-table-column prop="description" label="描述" sortable show-overflow-tooltip></el-table-column>
            <el-table-column prop="updateName" label="更新人" sortable show-overflow-tooltip></el-table-column>
            <el-table-column prop="updateTime" label="更新时间" sortable show-overflow-tooltip></el-table-column>
            <el-table-column prop="createTime" label="创建时间" sortable show-overflow-tooltip></el-table-column>
            <el-table-column label="操作">
                <template scope="scope">
                    <el-button size="small" type="primary" @click="updateRandom(scope.$index, scope.row)" v-if="scope.row.configType=='random'">修改随机数</el-button>
                    <el-button size="small" type="primary" @click="updateAvg(scope.$index, scope.row)" v-if="scope.row.configType=='avg'">修改倍数</el-button>
                </template>
            </el-table-column>
        </el-table>

        <div align="center">
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
                           :page-sizes="[20, 50, 80, 100]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="totalCount"
                           background>
            </el-pagination>
        </div>
    </div>

    <div v-show="!showList">
        <el-row>
            <el-col :span="8" :offset="8">
                <h4>随机奖励金倍数 <span style="color: red">(0-20之间)</span></h4>
                <div v-for="(item,index) of randoms">
                    <div class="input-group">
                        <span class="input-group-addon">随机数</span>
                        <input class="form-control" type="number" v-model="randoms[index]">
                        <span class="input-group-btn">
                            <button class="btn btn-default" type="button" @click="addRandom">+</button>
                            <button class="btn btn-default" type="button" @click="delRandom(index)">-</button>
                        </span>
                    </div>
                </div>
                <el-button size="small" type="primary" @click="updateRandomHandler">修改</el-button>
                <el-button size="small" type="primary" @click="showList=!showList">返回</el-button>
            </el-col>
        </el-row>
    </div>

    <el-dialog title="修改平均倍数" :visible.sync="dialogView" width="60%">
        <el-form :inline="true">
            <el-row>
                <el-col :span="8" :offset="8">
                    <el-select v-model="avg" placeholder="平均倍数">
                        <el-option v-for="(item,index) in randoms" :key="index" :label="item" :value="item">
                        </el-option>
                    </el-select>
                </el-col>
            </el-row>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button type="primary" size="medium" @click="updateAvgHandler">确定</el-button>
            <el-button type="primary" size="medium" @click="dialogView=!dialogView">取消</el-button>
        </div>
    </el-dialog>


</div>

<script src="${request.contextPath}/statics/js/modules/business/orderScholarshipConfig.js?_${.now?long}"></script>
<style>
    /* 设置当前选中行的背景颜色 */
    .el-table__body tr.current-row>td {
        background: #c9eff5 !important;
    }
</style>
</body>
</html>
